//==========================================================================
// Copyright (c) 2000-2006,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#if !defined(___FRAME_CAPTURE_H_)
#define ___FRAME_CAPTURE_H_

typedef void (*FrameCaptureCallBack)(void *pFrameBuffer);

// Internal structure
class FrameCapture {
public:
    //wincam screen width and height
    unsigned long         m_uScreenWidth;
    unsigned long         m_uScreenHeight;

    //wincam bit count
    unsigned int          m_uPixelBytes;

    // Platform depended variables
    HWND                  m_hWnd;     // Handle of emulator main window
    HWND                  m_hWndCap; // Handle of the capture window

    // Camera status
    BOOL m_bCapture;

    // callback function
    FrameCaptureCallBack  m_CaptureFunc;

    HANDLE                m_hCapThreadEvent;

private:
    HANDLE                m_hCapThd;
    HANDLE                m_hCaptureLock;

public:
    void CapLock();

    void CapUnlock();

public:
    int  Initialize();

    void Destroy();

    void GetFrameDataInfo(unsigned long* pWidth,
                          unsigned long* pHeight,
                          unsigned int *pPixelBytes);

    void BeginCapture(FrameCaptureCallBack pFrameCapFunc);

    void StopCapture();
};

#endif//___FRAME_CAPTURE_H_
